﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		InvocationToken.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 //   File:            InvocationToken.cs
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;

namespace Dexter.Async {
	public class InvocationToken {
		/// <summary>
		/// Initializes a new instance of the <see cref="T:System.Object"/> class.
		/// </summary>
		public InvocationToken ( Action <object> call , object state , VoidAsyncResult asyncResult , bool isReadOnly ) {
			Call = call;
			State = state;
			AsyncResult = asyncResult;
			IsReadOnly = isReadOnly;
		}

		public InvocationToken ( Action <object> call , object state , VoidAsyncResult asyncResult ) {
			Call = call;
			State = state;
			AsyncResult = asyncResult;
			IsReadOnly = false;
		}

		public Action <Object> Call { get; private set; }
		public Object State { get; private set; }
		public VoidAsyncResult AsyncResult { get; set; }
		public bool IsReadOnly { get; set; }

		public void Invoke ( ) {
			Call ( State );
		}
	}
}
